package com.fzx.fzwsupplysystem.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.fzx.fzwsupplysystem.SplashActivity;

/**
 * 描述：    开机广播，自启
 * 项目名称：AndroidUtilsDemo
 * 创建人：  FangZhixin
 * 创建时间：2018/6/27
 */
public class BootBroadcastReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        String TAG = "BootBroadcastReceiver";
        Log.i(TAG, "onReceive: action=" + action);
        String ACTION_BOOT = "android.intent.action.BOOT_COMPLETED";
        if (ACTION_BOOT.equals(action)) {//监听开机广播
            Intent i = new Intent(context, SplashActivity.class);
            i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(i);
        }

    }
}
